<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>用户登录 - 博客系统</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.5.0/dist/semantic.min.css">
    <style>
        /* 1. 全局背景和居中 */
        body {
            height: 100vh;
            display: flex; /* 使用 Flexbox 进行完美居中 */
            justify-content: center;
            align-items: center;
            background-color: #f0f2f5; /* 柔和的浅灰色背景 */
            margin: 0;
        }

        /* 2. 现代卡片样式：宽度、圆角、柔和阴影 */
        .modern-card {
            max-width: 380px;
            width: 100%;
            padding: 3em 3em; /* 统一增加内边距，拉长卡片视觉效果 */
            background: #ffffff; /* 纯白色背景 */
            border-radius: 12px; /* 柔和的圆角 */
            /* 现代柔和阴影 */
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.05);
        }

        /* 3. 简化标题 */
        .ui.header.main-title {
            margin-bottom: 2em; /* 标题与表单间距加大 */
            font-weight: 500; /* 字体不要太粗 */
            color: #333;
        }

        /* 4. 输入框样式微调 */
        .ui.icon.input > input {
            border-radius: 6px !important;
        }

        /* 5. 按钮样式微调 */
        .ui.button.submit {
            border-radius: 6px !important;
            height: 50px; /* 增加按钮高度，更易点击 */
            margin-top: 1.5em;
            background-color: #1abc9c !important; /* 更现代的青色/绿色 */
        }
    </style>
</head>
<body>

<div class="modern-card">

    <h2 class="ui header main-title center aligned">
        博客管理系统登录
    </h2>

    <form class="ui large form" method="post" action="#" th:action="@{/login}">

        <div class="field">
            <div class="ui left icon input">
                <i class="user icon"></i>
                <input type="text" name="username" placeholder="用户名" required>
            </div>
        </div>

        <div class="field">
            <div class="ui left icon input">
                <i class="lock icon"></i>
                <input type="password" name="password" placeholder="密码" required>
            </div>
        </div>

        <button class="ui fluid large submit button">登录</button>

        <div class="ui error message" th:if="${error}" style="margin-top: 1em;">
            <i class="close icon"></i>
            <div class="header">登录失败</div>
            <p th:text="${error}">错误信息占位符</p>
        </div>

    </form>

</div>

<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.5.0/dist/semantic.min.js"></script>

<script>
    // 初始化 Semantic UI 的消息框关闭功能
    $('.message .close')
        .on('click', function() {
            $(this)
                .closest('.message')
                .transition('fade')
            ;
        })
    ;
</script>

</body>
</html>